package cn.edu.hqu.cst.crj.layoutdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.content.Intent;
import android.view.View;


public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //线性布局
        findViewById(R.id.btn_linear_layout).setOnClickListener(this);
        //相对布局
        findViewById(R.id.btn_relative_layout).setOnClickListener(this);
        //帧布局
        findViewById(R.id.btn_frame_layout).setOnClickListener(this);
        //表格布局
        findViewById(R.id.btn_table_layout).setOnClickListener(this);
        //网格布局
        findViewById(R.id.btn_grid_layout).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent=new Intent();
        switch (v.getId()) {
            case R.id.btn_linear_layout:
                intent.setClass(MainActivity.this, Linear.class);
                break;
            case R.id.btn_relative_layout:
                intent.setClass(MainActivity.this, Relative.class);
                break;
            case R.id.btn_frame_layout:
                intent.setClass(MainActivity.this, Frame.class);
                break;
            case R.id.btn_table_layout:
                intent.setClass(MainActivity.this, Table.class);
                break;
            case R.id.btn_grid_layout:
                intent.setClass(MainActivity.this, Grid.class);
                break;
        }
        startActivity(intent);
    }

}
